/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itsc.dswII.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Lenovo-user
 */
@Entity
@Table(name = "interes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Interes.findAll", query = "SELECT i FROM Interes i"),
    @NamedQuery(name = "Interes.findById", query = "SELECT i FROM Interes i WHERE i.id = :id"),
    @NamedQuery(name = "Interes.findByCatigoria", query = "SELECT i FROM Interes i WHERE i.catigoria = :catigoria"),
    @NamedQuery(name = "Interes.findByDescripcion", query = "SELECT i FROM Interes i WHERE i.descripcion = :descripcion"),
    @NamedQuery(name = "Interes.findDuplicity", query = "SELECT i FROM Interes i WHERE i.id = :id AND i.catigoria=:categoria AND i.descripcion=:descripcion")
})
public class Interes implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "catigoria")
    private int catigoria;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "descripcion")
    private String descripcion;
    @JoinColumn(name = "Persona_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Persona personaid;

    public Interes() {
    }

    public Interes(Integer id) {
        this.id = id;
    }

    public Interes(Integer id, int catigoria, String descripcion) {
        this.id = id;
        this.catigoria = catigoria;
        this.descripcion = descripcion;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getCatigoria() {
        return catigoria;
    }

    public void setCatigoria(int catigoria) {
        this.catigoria = catigoria;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Persona getPersonaid() {
        return personaid;
    }

    public void setPersonaid(Persona personaid) {
        this.personaid = personaid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Interes)) {
            return false;
        }
        Interes other = (Interes) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.itsc.dswII.model.Interes[ id=" + id + " ]";
    }
}
